<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('修改虚拟组织人员')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: select2-css"/>
</head>
<style>
    .select2{
        width: 100% !important;
    }
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-retire-edit" AUTOCOMPLETE="OFF">
        <input name="id" id="id" type="hidden" th:value="${editJoin.id}"/>
        <div class="form-group">
            <label class="col-sm-3 control-label ">工号：</label>
            <div class="col-sm-8">
                <input class="form-control" id="badge" type="text" th:value="${editJoin.badge}"
                       readonly="readonly"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">姓名：</label>
            <div class="col-sm-8">
                <input class="form-control" id="name" type="text" th:value="${editJoin.name}"
                       readonly="readonly"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">公司名称：</label>
            <div class="col-sm-8">
                <input class="form-control" id="compName" type="text" th:value="${editJoin.compName}"
                       readonly="readonly"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">部门名称：</label>
            <div class="col-sm-8">
                <input class="form-control" id="depName" type="text" th:value="${editJoin.depName}"
                       readonly="readonly"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">岗位名称：</label>
            <div class="col-sm-8">
                <input class="form-control" id="jobName" type="text" th:value="${editJoin.jobName}"
                       readonly="readonly"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">虚拟部门：</label>
            <div class="col-sm-8">
                <select name="virtualDepName" id="virtualDepName" class="form-control">
                    <option value="">请选择</option>
                    <option th:each="virtualDep : ${virtualDep}" th:text="${virtualDep.title}"
                            th:value="${virtualDep.depId}"
                            th:selected="${editJoin.virtualDepName==virtualDep.title ? true : false}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">虚拟岗位：</label>
            <div class="col-sm-8">
                <select name="virtualJobName" id="virtualJobName" class="form-control">
                    <option value="">请选择</option>
                    <option th:each="virtualJob : ${virtualJob}" th:text="${virtualJob.title}"
                            th:value="${virtualJob.jobId}"
                            th:selected="${editJoin.virtualJobName==virtualJob.title ? true : false}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">原因描述：</label>
            <div class="col-sm-8">
                <input class="form-control" name="reason" id="reason" type="text" th:value="${editJoin.reason}"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">加入时间：</label>
            <div class="col-sm-8">
                <input class="form-control" name="beginDate" id="beginDate" type="text" th:value="${editJoin.beginDate}"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">备注：</label>
            <div class="col-sm-8">
                <input class="form-control" name="remark" id="remark" type="text" th:value="${editJoin.remark}"/>
            </div>
        </div>
    </form>
</div>


<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: datetimepicker-js"/>

<script th:inline="javascript">

    var prefix = ctx + "changeManage/virtualOrganize";

    $(function () {
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '#beginDate',
                type: 'date'
            });
        });

    });


    function submitHandler() {
        if ($.validate.form()) {
            var data = $("#form-retire-edit").serializeArray();
            var virtualDepName = $("#virtualDepName").val();
            var virtualJobName = $("#virtualJobName").val();
            var beginDate = $("#beginDate").val();
            if (virtualDepName == "" || virtualDepName == null) {
                $.modal.alertWarning("请选择虚拟部门!");
                return;
            }
            if (virtualJobName == "" || virtualJobName == null) {
                $.modal.alertWarning("请选择虚拟岗位!");
                return;
            }
            if (beginDate == "" || beginDate == null) {
                $.modal.alertWarning("请输入加入日期!");
                return;
            }
            $.operate.save(prefix + "/editJoin", data);
        }
    }

</script>


</body>
</html>